package com.common.frame.utils;


import android.widget.Toast;

import com.hjq.toast.ToastUtils;
import com.hjq.toast.style.ToastWhiteStyle;


/**
 * 静态Toast
 */
public class ToastUtil {

    private static boolean first = true;

    public static void init(){
        if (first){
            first = false;
            synchronized (ToastUtil.class){
                ToastUtils.init(AppGlobals.getApplication());
                ToastUtils.initStyle(new ToastWhiteStyle(AppGlobals.getApplication()));
            }
        }
    }

    /**
     * 显示短时间Toast
     * @param txt 显示内容
     */
    public static void showShortToast(String txt) {
        init();
        ToastUtils.show(txt);
    }


    public static void showLongToast(String txt) {
        Toast.makeText(AppGlobals.getApplication(), txt, Toast.LENGTH_LONG).show();
    }
}